<template>
  <div class="container">
    <div class="cheader2">
      <van-icon
        @click="goBack"
        class="chl"
        name="arrow-left"
        color="#000"
        size="20"
      />
      <div class="chtitle">业绩明细</div>
      <div class="djbox"></div>
    </div>
    <div class="mbox">
      <div class="mul" v-if="fuelList.length">
        <div class="mli" v-for="item in fuelList" :key="item.id">
          <card-item :propItems="fuelPropItems" :detail="item"></card-item>
        </div>
      </div>
      <van-empty
        v-else
        description="暂无数据"
        image-size="100"
        :image="require('@/assets/images/null.png')"
      />
    </div>
  </div>
</template>
  
  <script setup lang='ts'>
import { reactive, ref, onMounted } from "vue";
import { useRouter, useRoute } from "vue-router";
import CardItem from "@/components/CardItem/index.vue";
import http from "@/utils/http";

onMounted(() => {
  getList();
});
const route = useRoute();
const router = useRouter();
const fuelList = ref<any>([]);
const getList = () => {
  http
    .post("user/fuel_consume/app/page", {
      current: 1, //页数
      size: 200, //每页条数
      userId: route.query?.id,
    })
    .then((res: any) => {
      if (res.code === 0) {
        fuelList.value = res.data.records;
      }
    });
};
const fuelPropItems = reactive([
  {
    name: "订单号",
    prop: "orderId",
  },
  {
    name: "策略",
    prop: "strategyName",
  },
  {
    name: "燃烧数量(USDT)",
    prop: "fuelQuantity",
  },
  {
    name: "消耗类型",
    prop: "type",
  },
  {
    name: "时间",
    prop: "createTime",
  },
]);
const goBack = () => {
  router.go(-1);
};
</script>
  
  <style lang="scss" scoped>
.cheader2 {
  width: 100%;
  height: 45px;
  background-color: #fff;
  font-size: 16px;
  color: #000;
  position: fixed;
  top: 0;
  left: 0;
  .chl {
    position: absolute;
    left: 16px;
    top: 50%;
    text-align: center;
    transform: translateY(-50%);
  }
  .chtitle {
    position: absolute;
    left: 50%;
    top: 50%;
    text-align: center;
    transform: translate(-50%, -50%);
  }
  .djbox {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    img {
      width: 16px;
      margin-right: 4px;
    }
    div {
      font-size: 13px;
      color: #878b97;
    }
  }
}
.mbox {
  padding: 10px 16px 0;
  margin-top:45px;
  .mtitle {
    font-size: 15px;
    color: #000;
    margin: 0px 0 10px;
  }
  .mli {
    padding: 10px 0;
    border-bottom: 1px solid #f1f1f1;
  }
}
</style>